<?php


namespace App\Http\Controllers\admin\validate;


use Illuminate\Support\Facades\Validator;

class PAD
{
    public static function queryTeacherLocking($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function importTeacherLocking($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'file'=>'required|file',
            'lastIp'=>'required|ip',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'file.required'=>'文件为空',
            'file.numeric'=>'文件格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryParentLocking($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function importParentLocking($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'file'=>'required|file',
            'lastIp'=>'required|ip',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'file.required'=>'文件为空',
            'file.numeric'=>'文件格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function importTeacherReset($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'file'=>'required|file',
            'lastIp'=>'required|ip',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'file.required'=>'文件为空',
            'file.numeric'=>'文件格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryTeacherReset($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function importParentReset($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'file'=>'required|file',
            'lastIp'=>'required|ip',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'file.required'=>'文件为空',
            'file.numeric'=>'文件格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryParentReset($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function adminRelieveBindSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'sn'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'sn.required'=>'sn码为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

}